package Driver;

import EventManager.ClientPerson;
import Model.Person;
import Service.OutputManager;

/**
 * This class tests the synchronization capabilites of the system by making several clients make concurrent requests.
 * 
 * @author Yury Kitaev
 *
 */
public class MultithreadingTestOperationStrategy implements OperationStrategy 
{
	@Override
	public void run() 
	{
		
		OutputManager.println("\nMULTITHREADING TEST MODE ENGAGED, GET READY!!!!!!!\n");
		
		// Create a person and a bot for him
		Person hank = new ClientPerson("Hank", "Rearden");
		AsyncBot hankBot = new AsyncBot(hank);
		
		Person dagny = new ClientPerson("Dagny", "Taggart");
		AsyncBot dagnyBot = new AsyncBot(dagny);
		
		Person lilian = new ClientPerson("Lilian", "Rearden");
		AsyncBot lilianBot = new AsyncBot(lilian);
		
		Person mouch = new ClientPerson("Wesley", "Mouch");
		AsyncBot mouchBot = new AsyncBot(mouch);
		
		hankBot.start();
		lilianBot.start();
		dagnyBot.start();
		mouchBot.start();
		
		
		try
		{
			hankBot.join();
			mouchBot.join();
			dagnyBot.join();
			lilianBot.join();
			
			OutputManager.println("\nMULTITHREADING TEST MODE SUCCESSFULLY COMPLETED\n(scroll up)\n");
		} 
		catch (InterruptedException e) 
		{
			return;
		}
		
	}

}
